 var vnode= {
        tag:'ul',
        attrs:{
            id:'list'
        },
        children:[
            {
                tag:'li',
                attrs:{
                    className:'item'
                },
                children:['item 1']
            }
        ]
    }

function createElement(vnode){
    var tag=vnode.tag
    var attrs=vnode.attrs || {}
    var children = vnode.children || []
    if (!tag) {
        return null
    }

    //创建元素
    var elem=document.createElement(tag)
    //属性
    var attrsName
    for (attrsName in attrs) {
        if (attrs.hasOwnProperty(attrsName)) {
            elem.setAttribute(attrsName,attr                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                s[attrsName])
            
        }
    }

    //子元素
    children.forEach(function(childVnode){
        //递归调用 createElement 创建子元素
        elem.appendChild(createElement(childVnode))
    });

    return elem
}